﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using FeedAntGame.Sprite.Event;

namespace FeedAntGame.Control
{
    class CandyFeed : BaseControl
    {
        Candy.TYPE type;
        /************************************************************************/
        /*                  GET/SET                                                                     */
        /************************************************************************/        

        internal Candy.TYPE Type
        {
            get { return type; }
            set { type = value; }
        }
        
        /************************************************************************/
        /*                  Constructor                                                                     */
        /************************************************************************/

        public CandyFeed(Game game, Candy.TYPE type, Vector2 position)
            :base(game)
        {            
            this.type = type;
            createInstance(position);
        }

        protected override void createInstance(Vector2 position)
        {
            switch (type)
            {
                case Candy.TYPE.ORANGE:
                    sprite = new CandyFeedSprite(
                        Game.Content.Load<Texture2D>(@"Images\coldown"),
                        Game.Content.Load<Texture2D>(@"Images\orange_candy_cover"),
                        Game.Content.Load<Texture2D>(@"Images\orange_candy_normal"),
                        Game.Content.Load<Texture2D>(@"Images\orange_candy_cover"),
                        Game.Content.Load<Texture2D>(@"Images\orange_candy_disable"),
                        position, new Point(64, 68), 2, new Point(1, 1), Vector2.Zero, null, 0.5f, 3000,type);
                    (sprite as CandyFeedSprite).WaitingRectOffset = 6;
                    (sprite as CandyFeedSprite).Coldown = 20000;
                    break;
                case Candy.TYPE.PEARL:
                    sprite = new CandyFeedSprite(
                        Game.Content.Load<Texture2D>(@"Images\coldown"),
                        Game.Content.Load<Texture2D>(@"Images\yellow_candy_cover"),
                        Game.Content.Load<Texture2D>(@"Images\yellow_candy_normal"),
                        Game.Content.Load<Texture2D>(@"Images\yellow_candy_cover"),
                        Game.Content.Load<Texture2D>(@"Images\yellow_candy_disable"),
                        position, new Point(64, 64), 2, new Point(1, 1), Vector2.Zero, null, 0.5f, 3000,type);
                    (sprite as CandyFeedSprite).WaitingRectOffset = 6;
                    (sprite as CandyFeedSprite).Coldown = 20000;
                    break;
            }                
        }

    }
}
